<!DOCTYPE HTML>
<html>
<head>
    <title>安置帮教基本信息页面</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css"/>
    <link href="/static/css/default.css" rel="stylesheet" type="text/css"/>
    <script src="/static/js/common/common.js" type="text/javascript"></script>
</head>
<body  onload="onLoad()">
<div class="mini-fit" style="margin-bottom: 45px;">

    <div align="left">
        <b style="font-size: 18px;">&nbsp;&nbsp;&nbsp;资源信息：</b>
    </div>
    <!-- 就业推荐-->
    <div id="tjchoose" class="form"  >
        <table class="form-table"  width="100%" >
            <tr>
                <td width="49%" align="right">
                    <a class="mini-button"  plain="true" onclick="chooseSub(1)">就业推荐</a>
                </td>
                <td width="2%" align="center">
                    <h3>|</h3>
                </td>
                <td width="49%" align="left">
                    <a class="mini-button"  plain="true" onclick="chooseSub(2)">基地推荐</a>
                </td>
            </tr>
        </table>
    </div>
    <div id="jytj" class="form" style="width: 100%;display: none;" >
        <table class="form-table"  width="100%" >
            <tr>
                <td colspan="2" >
                    <div id="datagrid1" class="mini-datagrid" style="width: 100%;" ajaxType="get" alwaysShowEmptyText="true"
                         autoload="true" showEmptyText="true"  emptyText="暂无数据" multiSelect="true"  showPager="true"  sizeList="[5,10,20]" pageSize="5"
                         url="/azbj/azbjgl/azgzgl/getJytjList?priNum=${priNum!''}">
                        <div property="columns">
                            <div type="indexcolumn" width="5%" align="center"  headerAlign="center">序号</div>
                            <div name="gsmc" field="gsmc"  width="20%" align="center"  headerAlign="center" allowSort="false">公司名称
                            </div>
                            <div name="zwmc" field="zwmc"   width="10%" align="center" headerAlign="center" allowSort="false">职位名称
                            </div>
                            <div name="zwyx" field="zwyx" width="6%"  align="center" headerAlign="center" allowSort="false">职位月薪
                            </div>

                            <div name="gsdd" field="gsdd"   width="20%" align="center" headerAlign="center"allowSort="false"> 公司地址
                            </div>
                            <div name="gsxz" field="gsxz"  width="7%" align="center" headerAlign="center" allowSort="false">公司性质
                            </div>
                            <div name="gsgm" field="gsgm"  width="10%" align="center" headerAlign="center" allowSort="false">公司规模
                            </div>
                            <div name="addusername" field="addusername"  width="10%" align="center" headerAlign="center" allowSort="false">录入单位
                            </div>
                            <div name="lrsj" field="lrsj"  width="12%" align="center" headerAlign="center" allowSort="false">录入时间
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div id="jdtj" class="form" style="width: 100%;display: none;" >
        <table class="form-table"  width="100%" >
            <tr>
                <td colspan="2" >
                    <div id="datagrid1" class="mini-datagrid" style="width: 100%;" ajaxType="get" alwaysShowEmptyText="true" autoload="true" showEmptyText="true"
                         emptyText="暂无数据" multiSelect="true"  showPager="true"  sizeList="[5,10,20]" pageSize="5"  url="/azbj/azbjgl/azgzgl/getJdtjList?priNum=${priNum!''}">
                        <div property="columns">
                            <div type="indexcolumn" width="5%" align="center"  headerAlign="center">序号</div>
                            <div name="jdmc" field="jdmc"  width="20%" align="center"  headerAlign="center" allowSort="false">基地名称
                            </div>
                            <div name="jdxz" field="jdxz"   width="10%"  align="center" headerAlign="center"allowSort="false">基地性质
                            </div>
                            <div name="jiuzhutype" field="jiuzhutype" width="11%"  align="center" headerAlign="center">救助类型
                            </div>
                            <div name="dz" field="dz"   width="15%" align="center" headerAlign="center"allowSort="false"> 基地地址
                            </div>
                            <div name="fr" field="fr"  width="7%" align="center" headerAlign="center" allowSort="false">联系人
                            </div>
                            <div name="phone" field="phone"  width="10%" align="center" headerAlign="center" allowSort="false">手机号码
                            </div>
                            <div name="tel" field="tel"  width="10%" align="center" headerAlign="center" allowSort="false">固话
                            </div>
                            <div name="lrsj" field="lrsj"  width="10%" align="center" headerAlign="center" allowSort="false">录入时间
                            </div>
                            <div name="lrdw" field="lrdw"  width="12%" align="center" headerAlign="center" allowSort="false">录入单位
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </br>
    <hr/>
    </br>
    <form id="form1" method="post" style="padding-top: 10px;">
        <div align="left">
            <b style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;安置信息：</b>
        </div>
        <!-- 用户 编辑框START-->
        <div id="editform1" class="form" >
            <table class="form-table"  width="100%"  >
                <input id="priNum" name="priNum" class="mini-hidden" value="${priNum!''}" style="width: 100%;"  readonly/>
                <input id="pid" name="pid" class="mini-hidden" value="${pid!''}" style="width: 100%;"  readonly/>
                <input id="id" name="id" class="mini-hidden" value="${azId!''}" style="width: 100%;"  readonly/>
                <input id="edit" name="edit" class="mini-hidden" value="${edit!''}" style="width: 100%;"  readonly/>
                <tr>
                    <td  align="right" style="line-height: 30px;width:10% ">证&emsp;&emsp;书:</td>
                    <td style="line-height: 30px;width:54% " colspan="2">
                        ${certs!'无'}
                    </td>
                </tr>
                <tr>
                    <td  align="right" style="line-height: 30px;width:15% ">安置时间:</td>
                    <td style="line-height: 30px;width:20% ">
                        <input class="mini-datepicker" style="width: 100%" allowInput="false" value="${jiandangDate!''}" id="jiandangDate" name="jiandangDate" ondrawdate="onDrawDate"/>
                    </td>

                    <td  align="right" style="line-height: 30px;width:10% ">安置帮教基地:</td>
                    <td style="line-height: 30px;width:54%;position: relative " colspan="2">
                        <input name="jdxz"  id="jdxz" class="mini-combobox" textField="codeName" valueField="codeId" emptyText="请选择..."
                               onvaluechanged="onAzjdChanged()" value="${jdxz!''}"
                               url="/azbj/shzzgl/socialOrgInfo/getComboboxData?codeType=3_6" />
                        <input name="jdid" id="jdid" class="mini-combobox"
                               value="${jdid!''}" textField="text" valueField="id"
                               url="/azbj/azbjgl/azgzgl/getAzjdList?azType=${jdxz!''}&priNum=${priNum!''}" onvaluechanged="jdChange()">
                        <label for="jdid" id="None" style="position: absolute;left: 162px;top: 24px;display: none;color: red">该基地人数已满</label>
                        </input>
                        <a id="saveNum" class="mini-button" style="display: none;" onclick="saveNum()">+新增人数</a>
                    </td>
                </tr>
                <tr>
                    <td  align="right" style="line-height: 50px;"><font color="#dc143c">*</font>安置方式:</td>
                    <td class="input" colspan="4">
                        <input name="anzhiqingkuang" id="anzhiqingkuang" class="mini-checkboxlist" onvaluechanged="onAzfsChanged" repeatItems="6" repeatLayout="table" value="${anzhiqingkuang!''}"
                               data="[{ id: '01', name: '落实责任田' },{ id: '02', name: '公益性岗位安置' },{ id: '03', name: '自主创业' },{ id: '04', name: '从事个体经营' },
                               { id: '05', name: '企业和经济实体吸纳企业' },{ id: '06', name: '其他安置方式' }]"
                               textField="name" valueField="id"  required="true"/>
                    </td>
                </tr>
                <tr>
                    <td  align="right" style="line-height: 10px;"><font color="#dc143c">*</font>是否协助办理社保:</td>
                    <td >
                        <input name="shehuibaoxian" id="shehuibaoxian" class="mini-radiobuttonlist" value="${shehuibaoxian!''}"
                               data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                               textField="name" valueField="id" value="1" required="true"/>
                    </td>
                    <td  align="right" style="line-height: 10px;"><font color="#dc143c">*</font>是否失业:</td>
                    <td >
                        <input name="issy" id="issy" class="mini-radiobuttonlist" value="${issy!''}"  onvaluechanged="onIfSyChanged"
                               data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                               textField="name" valueField="id" value="1" required="true"/>
                    </td>
                </tr>
                <tr id="zizhuchuangye-tr">
                    <td  align="right"  style="line-height: 30px;"><font color="#dc143c">*</font>自主创业:</td>
                    <td colspan="2">
                        <input name="zizhuchuangye" id="zizhuchuangye" class="mini-radiobuttonlist" value="${zizhuchuangye!''}"
                               data="[{ id: 1, name: '是' },{ id: 2, name: '否 (减免税政策)' }]"
                               textField="name" valueField="id" value="1" required="true"/>
                    </td>
                </tr>
                <tr id="getijingying-tr">
                    <td  align="right"  style="line-height: 30px;"><font color="#dc143c">*</font>从事个体经营:</td>
                    <td colspan="2">
                        <input name="getijingying" id="getijingying" class="mini-radiobuttonlist" value="${getijingying!''}"
                               data="[{ id: 1, name: '是' },{ id: 2, name: '否 (减免税政策)' }]"
                               textField="name" valueField="id" value="1" required="true"/>
                    </td>
                </tr>
                <tr id="xinajiuye-tr">
                    <td align="right" style="line-height: 30px;"><font color="#dc143c">*</font>企业和经济实体吸纳</td>
                    <td colspan="2">
                        <input name="xinajiuye" id="xinajiuye" class="mini-radiobuttonlist" value="${xinajiuye!''}"
                               data="[{ id: 1, name: '是' },{ id: 2, name: '否 (减免税政策)' }]"
                               textField="name" valueField="id" value="1" required="true"/>
                    </td>
                </tr>
            </table>
        </div>
        <!-- 工作信息-->
        <div class="form"  id="jyxx" style="display: none;" >
            <table class="form-table"  width="100%" >
                <tr>
                    <td  align="right" style="line-height: 30px;width:15% "> <font color="#dc143c">*</font>工作单位名称:</td>
                    <td style="line-height: 30px;width:20% ">
                        <input name="danwei"  id="danwei" style="width: 100%" class="mini-textbox"   value="${danwei!''}" required="true"/>
                    </td>
                    <td  align="right" style="line-height: 30px;width:10% ">工作起止时间:</td>
                    <td style="line-height: 30px;width:54% " colspan="2">
                        <input property="editor"  style="width: 140px" class="mini-datepicker"  emptyText="起始时间" allowInput="true"  value="${workstart!''}" id="workstart" name="workstart"/>
                        <input property="editor" style="width: 140px" class="mini-datepicker"  emptyText="结束时间"  allowInput="true"  value="${workend!''}" id="workend" name="workend"/>
                    </td>
                </tr>
            </table>
        </div>

        <!-- 减免税政策-->
        <div class="form" id="lszrt"  style="display: none" >
            <table class="form-table"  width="100%" >
                <tr>
                    <td   align="right" style="line-height: 40px;width:15% "><font color="#dc143c">*</font>安置地点选择:</td>
                    <td style="line-height: 40px;">
                        <input  id = "province" name="province"  class="mini-combobox" required="true" emptyText = "省份" style="width:120px;"  textfield="codeName" valueField="codeId"
                                url="/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=-1" value="${province!''}"  onclick="onDeptChanged('province')" onvaluechanged = "onValueChanged('province')"/>
                        <input  id = "city" name="city"  class="mini-combobox" required="true"  emptyText = "市" style="width: 120px"  textfield="codeName" valueField="codeId"
                                url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=${province!''}"  value="${city!''}"  onclick="onDeptChanged('city')" onvaluechanged = "onValueChanged('city')"  />
                        <input  id = "couty" name="couty"  class="mini-combobox" required="true"  emptyText = "县" style="width: 120px"  textfield="codeName" valueField="codeId"
                                url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=${city!''}" value="${couty!''}" onclick="onDeptChanged('couty')"  onvaluechanged = "onValueChanged('couty')"  />
                        <input  id = "village" name="village"  class="mini-combobox" required="true"  emptyText = "街道" style="width: 120px"
                                url = "/azbj/bjdxInfo/getStreet?parentCode=${couty!''}" value="${village!''}" textfield="name" valueField="code"onclick="onDeptChanged('village')"    />
                        <input class="mini-textbox" style="width: 360px" emptyText = "详细地址" id="num" name="num"  value="${num!''}"  required="true"/>
                    </td>
                </tr>
            </table>
        </div>

        <!-- 用户 编辑框START-->
        <div id="fileform" class="form" style="width: 100%">
            <table class="form-table"   width="100%">
                <tr>
                    <td width="15%" align="right" style="line-height: 40px;">
                        附件上传:
                    </td>
                    <td>
                        <input type="button" value="上传附件" onclick="onFileUpload()">
                        <span id="msg"></span>
                        <div><b>支持扩展名:</b>.rar .zip .doc .docx .xls .xlsx .pdf .jpg</div>
                    </td>
                </tr>
            </table>
        </div>
        <!-- 用户 编辑框START-->
        <div id="fileform" class="form" style="width: 100%">
            <table class="form-table"   width="100%">
                <tr>
                    <td width="15%" align="right">
                        备注:
                    </td>
                    <td width="85%" >
                        <input id="remark" name="remark" class="mini-textarea" value="${remark!''}" style="width:88%; height: 80px;"/>
                    </td>
                </tr>
            </table>
        </div>
        </br>
        <hr/>
        </br>
        <div align="left">
            <b style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;培训信息：</b>
        </div>
        <div id="editform2" class="form" >
            <table class="form-table"  width="100%"  >
                <tr>
                    <td  align="right" style="line-height: 30px;width:15% ">培训时间:</td>
                    <td style="line-height: 30px;width:20% ">
                        <input class="mini-datepicker" style="width: 100%" allowInput="false"
                               value="${pxsj!''}" id="pxsj" name="pxsj" ondrawdate="onDrawDate"/>
                    </td>

                    <td  align="right" style="line-height: 30px;width:10% ">培训机构:</td>
                    <td style="line-height: 30px;width:54% " colspan="2">
                        <input name="pxjg"  id="pxjg" class="mini-combobox"  textField="text" valueField="id" emptyText="请选择..."
                               style="width: 40%"  <#--onvaluechanged="onAzjdChanged()" -->   value="${pxjg!''}"
                               url="/azbj/azbjgl/azgzgl/getPxjgList" />
                    </td>
                </tr>
                <tr>
                    <td  align="right" style="line-height: 50px;">培训人:</td>
                    <td class="input" style="line-height: 30px;width:10% ">
                        <input name="pxr" id="pxr" class="mini-textbox"   value="${pxr!''}"
                               style="width: 100%"/>
                    </td>
                    <td  align="right" style="line-height: 30px;width:10% ">培训人手机号码:</td>
                    <td class="input" style="line-height: 30px;width:10% ">
                        <input name="pxrphone" id="pxrphone" class="mini-textbox"   value="${pxrphone!''}" onblur="checkPhone(2)" style="width: 100%" emptyText="请输入手机号码"/>

                    </td>
                    <td  align="right" style="line-height: 30px;width:10% ">培训人固话:</td>
                    <td class="input" style="line-height: 30px;width:54% ">
                        <input name="pxrtel" id="pxrtel" class="mini-textbox"   value="${pxrtel!''}" onblur="checkPhone(1)" style="width: 30%" emptyText="请输入固定电话"/>
                        <input name="pxrdh" id="pxrdh" class="mini-hidden"   />
                    </td>
                </tr>
                <tr>
                    <td width="15%" align="right">
                        培训内容:
                    </td>
                    <td width="85%" colspan="3">
                        <input id="pxnr" name="pxnr" class="mini-textarea" value="${pxnr!''}" style="width:88%; height: 80px;"/>
                    </td>
                </tr>
                <tr>
                    <td width="15%" align="right">
                        培训情况:
                    </td>
                    <td width="85%" colspan="3">
                        <input id="pxqk" name="pxqk" class="mini-textarea" value="${pxqk!''}" style="width:88%; height: 80px;"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>

</div>
<div style="position: absolute; bottom: 0;width:100%;border-top: 1px solid #dfdfdf;line-height: 45px;text-align: center">
    <a class="mini-button" iconCls="fa-save" plain="true" onclick="saveData()">保存</a>
    <a class="mini-button" iconCls="fa-undo" plain="true" onclick="close('close')">取消</a>
</div>
<script type="text/javascript">
    mini.parse();

    var priNumObj = mini.get("priNum");
    var editObj = mini.get("edit");
    var idObj = mini.get("id");
    var form = new mini.Form("form1");
    var jdxzObj = mini.get("jdxz");//安置帮教基地
    var jdidObj = mini.get("jdid");//基地id
    var azqkObj = mini.get("anzhiqingkuang");//安置情况

    var zizhuchuangye = mini.get("zizhuchuangye");
    var getijingying = mini.get("getijingying");
    var xinajiuye = mini.get("xinajiuye");

    var zrtzcObj = mini.get("zrtzc");//责任田政策
    var issyObj = mini.get("issy");//是否失业

    var province = mini.get("province");
    var city = mini.get("city");
    var couty = mini.get("couty");
    var village = mini.get("village");
    var pxrPhone = mini.get("pxrphone");
    var pxrTel = mini.get("pxrtel");
    var pxrdh = mini.get("pxrdh");

    // 页面一加载
    function onLoad(){
        $("#msg").text("上传成功" + ${count1} + "条!")
        if('${edit!''}' == "false"){
            onAzjdChanged();
        }
        onAzfsChanged();
        onIfSyChanged();
        chooseSub(1);
    }

    function refreshPage(action){
        if(action=="close"){
            window.location.reload();
        }
    }

    function onDrawDate(e) {
        var date = e.date;
        var d = new Date();
        if (date.getTime() > d.getTime()) {
            e.allowSelect = false;
        }
    }

    function chooseSub(e){
        if(e=="1"){
            document.getElementById("jytj").style.display="block";
            document.getElementById("jdtj").style.display="none";
        }else{
            document.getElementById("jytj").style.display="none";
            document.getElementById("jdtj").style.display="block";
        }
    }

    function saveData() {
        if (pxrPhone.getValue() != '' || pxrTel.getValue() != '') {
            pxrdh.setValue(pxrPhone.getValue()+'|'+pxrTel.getValue());
        }
        form.validate();
        if (form.isValid() == false) {
            return;
        }
        // 校验电话号码
        var phone = mini.get("pxrphone").getValue();
        var tel = mini.get("pxrtel").getValue();
        var newPhone = checkTelAndPhone(tel,phone);
        var flag = newPhone['flag'];
        if (flag) {
        } else {
            mini.alert("手机号码或固话有误，请重填");
            return;
        }
        var data = form.getData();
        var jdxz = jdxzObj.getValue();
        var jdanzhi = jdidObj.getText();
        data.zizhuchuangye = zizhuchuangye.getValue();
        data.getijingying = getijingying.getValue();
        data.xinajiuye = xinajiuye.getValue();
        data.jdxz = jdxz;
        data.jdanzhi = jdanzhi;
        var reg3 = RegExp(/[3]/);
        var reg4 = RegExp(/[4]/);
        var reg5 = RegExp(/[5]/);
        var azqk = azqkObj.getValue();
        if(azqk.match(reg3)){

        } else {
            data.zizhuchuangye="";
        }
        if(azqk.match(reg4)){

        } else {
            data.getijingying="";
        }
        if(azqk.match(reg5)){

        } else {
            data.xinajiuye="";
        }
        data.pid = priNumObj.getValue();
        var json = mini.encode(data);
        data.edit = editObj.getValue();
        $.ajax({
            url: "/azbj/azbjgl/azgzgl/saveAzInfo",
            type: "post",
            data: {data: json},
            success: function (result) {
                if(result.code == 1){
                    mini.alert("保存成功","成功",function(){
                        window.CloseOwnerWindow('ok');
                    });
                }else if(result.code==8001){
                    mini.alert("当前基地已满，请更换基地保存")
                }else if(result.code == 9001){
                    window.CloseParentWindow()
                }else if(result.code == 9002){
                    mini.alert("当前基地为禁用，请更换基地保存")
                }else if (result.code == 5599) {
                    mini.alert(result.message);
                }
            }
        });
    }

    function onAzjdChanged(){
        var jdxzVal =  jdxzObj.getValue();
        jdidObj.setValue();
        var url = "/azbj/azbjgl/azgzgl/getAzjdList?azType="+jdxzVal+"&priNum=" + priNumObj.getValue();
        jdidObj.setUrl(url);
        jdidObj.select(0);
        jdChange();
    }

    function onAzfsChanged(){
        var reg3 = RegExp(/[3]/);
        var reg4 = RegExp(/[4]/);
        var reg5 = RegExp(/[5]/);
        var azqk = azqkObj.getValue();
        if(azqk.match(reg3)){
            document.getElementById("zizhuchuangye-tr").style.display="table-row";
        } else {
            document.getElementById("zizhuchuangye-tr").style.display="none";
        }
        if(azqk.match(reg4)){
            document.getElementById("getijingying-tr").style.display="table-row";
        } else {
            document.getElementById("getijingying-tr").style.display="none";
        }
        if(azqk.match(reg5)){
            document.getElementById("xinajiuye-tr").style.display="table-row";
        } else {
            document.getElementById("xinajiuye-tr").style.display="none";
        }
        var reg1 = RegExp(/[1-2]/);
        if(azqk.match(reg1)){
            document.getElementById("lszrt").style.display="block";
        }else{
            document.getElementById("lszrt").style.display="none";
        }
    }

    function jdChange(){
        var azjd=jdidObj.getValue();
        $.ajax({
            url:"/azbj/azbjgl/azgzgl/searchAnZhiCount",
            data:{jdid:azjd},
            type:"post",
            success:function (obj) {
                if(obj.anzhirenshu != null && obj.keanzhirenshu != null && obj.anzhirenshu == obj.keanzhirenshu){
                    document.getElementById("saveNum").style.display="inline-block";
                    document.getElementById("None").style.display="inline-block";
                }else{
                    document.getElementById("saveNum").style.display="none";
                    document.getElementById("None").style.display="none";
                }
            }
        })
    }

    function onIfSyChanged(){
        var issy = issyObj.getValue();
        if(issy){
            if(issy==1){
                document.getElementById("jyxx").style.display="none";
            }else{
                document.getElementById("jyxx").style.display="block";
            }
        }
    }

    /**
     * 地址选择
     * @param e
     */
    var urltemp = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=-2";
    function onDeptChanged(e) {
        if("province" == e){
            var value = province.getValue();
            province.setValue("");
            var url =  "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=-1";
            province.setUrl(url);
            if(value!=''){
                province.setValue(value);
            } else {
                province.select(0);
            }
        }
        if("city" == e){
            var value = city.getValue();

            if(province.getValue()==""){
                city.setUrl(urltemp);
                city.setValue("");
                couty.setUrl(urltemp);
                couty.setValue("");
                village.setUrl(urltemp);
                village.setValue("");
                return;
            }
            var codeId = province.getValue();
            city.setValue("");
            var url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=" + codeId;
            city.setUrl(url);
            if(value!=''){
                city.setValue(value);
            } else {
                city.select(0);
            }
        }

        if("couty" == e) {
            var value = couty.getValue();

            if(city.getValue()==""){
                couty.setUrl(urltemp);
                couty.setValue("");
                village.setUrl(urltemp);
                village.setValue("");
                return;
            }
            var codeId = city.getValue();
            couty.setValue("");
            var url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=" + codeId;
            couty.setUrl(url);
            if(value!=''){
                couty.setValue(value);
            } else {
                couty.select(0);
            }
        }

        if("village" == e){
            var value = village.getValue();
            if(couty.getValue()==""){
                village.setUrl(urltemp);
                village.setValue("");
                return;
            }
            var parent_code = couty.getValue();
            village.setValue("");
            var url = "/azbj/bjdxInfo/getStreet?parentCode=" + parent_code;
            village.setUrl(url);
            if(value!=''){
                village.setValue(value);
            } else {
                village.select(0);
            }
        }
    }

    function onValueChanged(e) {
        if("province" == e){
            city.setValue("");
            couty.setValue("");
            village.setValue("");
        }

        if("city" == e){
            couty.setValue("");
            village.setValue("");
        }

        if("couty" == e) {
            village.setValue("");
        }

    }


    function onFileUpload(e) {
        var idval = idObj.getValue();
        if(!idval){
            idval="noid";
        }
        var prival = priNumObj.getValue();
        var taskid = "25";
        var url = "/upload/user/uploadAppendixfile/view?1=1&id="+idval+"&priNum="+prival+"&taskId=" + taskid;
        commonEdit(url, null, null,600, 400, true,true,true,callback);
        // 回调函数
        function callback() {
            $.ajax({
                url: "/upload/downloadAppendixFile/getCountById?1=1&priNum=${priNum!''}&taskId=25&id="+idval,
                type: "get",
                success: function (success) {
                    $("#msg").text("上传成功" + success.data + "条!");
                }
            })
            grid.reload();
        }
    }

    function close(action){
        if(window.CloseOwnerWindow){
            window.CloseOwnerWindow(action);
        }else{
            window.close();
        }
    }

    function saveNum() {
        var jdid=jdidObj.getValue()
        mini.open({
            url: "/azbj/azbjgl/azgzgl/saveNum?id="+jdid,
            title: "新增人数",
            width: "30%",
            height: "40%",
            allowDrag: true,
            allowResize: false,
            showCloseButton: true,
            onload: function () {
            },
            ondestroy: function (action) {
                jdChange();
                grid.reload();
            }
        });
    }

    // 获取页面的id priNum等
    function GetData() {
        var idval = idObj.getValue();
        var priNum1 = priNumObj.getValue();
        var data = {priNum: priNum1, id: idval, taskId: '25'};
        return data;
    }

    function checkPhone(e) {
        var phone = mini.get("pxrphone").getValue();
        var telPhone = mini.get("pxrtel").getValue();
        if (e == '1') {
            if(!validateTel(telPhone)) {
                mini.alert("固定电话有误，请重填");
            }
        }
        if (e == '2') {
            if(!validatePhone1(phone)) {
                mini.alert("手机号码有误，请重填");
            }
        }
    }
</script>
</body>
</html>